package w83b.w83bOperacionesPaso.w83bCitaciones;

import java.util.HashMap;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import w83b.w83bBeans.W83bPlantillasBean;
import w83b.w83bUtilidadesComunes.W83bClsConstantes;
import es.ejie.frmk.presentacion.operacion.paso.Q70ActionPasoOP;
import es.ejie.frmk.presentacion.sesiondatos.Q70ContextoEJIE;

public class W83bMostrarComunicacionCitacionAction extends Q70ActionPasoOP{


	
	protected void processOP(Q70ContextoEJIE contexto, ActionErrors errores, ActionMapping mapping,
			ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
		
		
	}

	protected ActionForward processForward(Q70ContextoEJIE contexto, ActionErrors errors, ActionMapping mapping, 
			ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
		
		
		

		HashMap mapa=(HashMap)contexto.get("w83bMapaCitaciones");
		StringBuffer buffer = (StringBuffer)mapa.get("bufferComunicacion");
		
		HashMap plantillas=(HashMap)contexto.get("w83bPlantillasMap");
		W83bPlantillasBean plantilla=(W83bPlantillasBean)plantillas.get(W83bClsConstantes.NOTIFICACION_CITACION.toUpperCase());
	
		
        response.setContentType("application/msword");
        response.setContentLength(buffer.toString().getBytes().length);
        response.setHeader("Content-disposition","attachment;filename="+plantilla.getNombrePlantilla());
        response.getOutputStream().write(buffer.toString().getBytes());
        response.getOutputStream().close();
        response.getOutputStream().flush();

		
		return mapping.findForward("ok");	
	}
	
		
}

